# tarfile
import tarfile
#
# tar = tarfile.open('/opt/demo.tar.gz', mode='w:gz')  # gz
# #
# tar.add('~/py001')
# tar.add('/root/geckodriver')
# #
# tar.close()

# tar = tarfile.open('/opt/demo02.tar', mode='a')
# tar.add('/root/py007')
# tar.close()

# tar = tarfile.open('/opt/demo.tar.gz', mode='r')
# print(tar.getmembers())
# for item in tar.getmembers():
#     print(item.name)
# tar.close()
#
# tar.extractall(path='/opt')
# tar.close()

with tarfile.open('hi.tar.bz', mode='w:bz2') as tar:
    tar.add('/root/day09')

